<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">
</head>
<body>
<div align="center">
    <h1>登录</h1>
    <input type="text" id="username" placeholder="用户名"><br/>
    <input type="password" id="password" placeholder="密码"><br/>
    <input type="submit" value="登录" id="login">
    <a href="register.html"><input type="button"  value="注册"></a>
</div>

</body>
<script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>
<script>
    $(function () {
        $("#login").click(function () {
            $.ajax({
                url:'/user/login',
                type:'post',
                data:{
                    username:$("#username").val(),
                    password:$("#password").val()
                },
                success :function (data) {
                    if(data.success){
                        window.location.href='info.html';
                    } else {
                        $.toast(data.errMsg);
                    }

                }
            });
        })

    })
</script>
</html>